<?php
/**
 * GeryEngine
 *
 * LICENSE
 *
 * This source file is subject to the new BSD license that is bundled
 * with this release in the file LICENSE
 *
 * @copyright  Copyright (c) 2007 Arjen Brouwer
 * @license    New BSD License
 * @author     Arjen Brouwer
 */

class TemplateLocation {
	
	private $templateName;
	private $macroName;
	private $lineNumber;
	
	public function __construct($lineNumber, $templateName, $macroName = null) {
		$this->templateName = $templateName;
		$this->macroName = $macroName;
		$this->lineNumber = $lineNumber;
	}
	
	public function getTemplateName() {
		return $this->templateName;
	}
	
	public function getMacroName() {
		return $this->macroName;
	}
	
	public function getLineNumber() {
		return $this->lineNumber;
	}
	
	public function __toString() {
		if ($this->macroName) {
			return sprintf("macro <b>#%s()</b> defined in <b>'%s'</b> on line <b>%d</b>", $this->macroName, $this->templateName, $this->lineNumber);
		} else {
			return sprintf("<b>'%s'</b> on line <b>%d</b>", $this->templateName, $this->lineNumber);
		}
	}
}
?>